package com.androidx.p013lv.base.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.widget.TextView;
import java.util.Arrays;

/* renamed from: com.androidx.lv.base.view.GradientTextView */
public class GradientTextView extends TextView {
    private boolean isGoldColor;
    private int[] mGradientColor;
    private int[] mGradientColor_default;
    private LinearGradient mLinearGradient;
    private Paint mPaint;
    private Rect mTextBound;
    private int mViewHeight;
    private int mViewWidth;

    public GradientTextView(Context context) {
        this(context, null);
    }

    public GradientTextView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public GradientTextView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.mViewWidth = 0;
        this.mViewHeight = 0;
        this.mGradientColor = new int[]{-1319753, -1517647};
        this.mGradientColor_default = new int[]{-1319753, -1517647};
        this.mTextBound = new Rect();
        this.mGradientColor = this.mGradientColor_default;
        setGravity(112);
    }

    public void setGradientColor(int[] iArr) {
        if (!Arrays.equals(iArr, this.mGradientColor)) {
            this.mGradientColor = iArr;
            invalidate();
        }
    }

    /* access modifiers changed from: protected */
    public void onDraw(Canvas canvas) {
        this.mViewWidth = getMeasuredWidth();
        this.mViewHeight = getMeasuredHeight();
        this.mPaint = getPaint();
        String charSequence = getText().toString();
        this.mPaint.getTextBounds(charSequence, 0, charSequence.length(), this.mTextBound);
        LinearGradient linearGradient = new LinearGradient(0.0f, 0.0f, 0.0f, (float) this.mViewHeight, this.mGradientColor, (float[]) null, Shader.TileMode.REPEAT);
        this.mLinearGradient = linearGradient;
        this.mPaint.setShader(linearGradient);
        canvas.drawText(charSequence, (float) ((getMeasuredWidth() / 2) - (this.mTextBound.width() / 2)), (float) ((getMeasuredHeight() / 2) + (this.mTextBound.height() / 3) + 3), this.mPaint);
    }
}
